package com.design3.graduatethesissys.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.design3.graduatethesissys.domain.PingJia;
import com.design3.graduatethesissys.mapper.ChuqiMapper;
import com.design3.graduatethesissys.service.ChuqiService;

/** 
* @author 作者 罗穆健: 
* @version 创建时间：2020年1月3日 下午5:31:28 
* 类说明 
*/
@Service
public class ChuqiServiceImpl implements ChuqiService{
	
	@Autowired
	ChuqiMapper chuqiJiaMapper;

	@Override
	public List<PingJia> chuQiList(String stu_id,String pj_status) {
		System.out.println(stu_id + pj_status);
		return chuqiJiaMapper.pingJiList(stu_id, pj_status);
	}

	@Override
	public Map<String, Object> savePingjia(PingJia pingjia) {
		Map<String, Object> result = new HashMap<String, Object>();
		String stu_id = pingjia.getStu_id();
		String stu_status = "";
		try {
			if("pj01".equals(pingjia.getPj_status())) {
				stu_status = "st03";
			}else if("pj02".equals(pingjia.getPj_status())) {
				stu_status = "st04";
			}else if("pj03".equals(pingjia.getPj_status())) {
				stu_status = "st05";
			}
			chuqiJiaMapper.savePingjia(pingjia);
			chuqiJiaMapper.updateSstatus(stu_status, stu_id);
			result.put("code", "200");
			return result;
		}catch (Exception e) {
			e.printStackTrace();
			result.put("code", "500");
			return result;
		}
	}
}
 